package com.dahua.strategy.version2;

/**
 * @author sunhongguang
 * @create 2022-01-11-0:13
 */
public class CashContext {

    private CashSuper cashSuper;

    public CashContext(String type){
        switch (type){
            case "正常收费":
                this.cashSuper = new CashNormal();
                break;
            case "满300减100":
                this.cashSuper = new CashReturn(300, 100);
                break;
            case "打8折":
                this.cashSuper = new CashRebate(0.8);
                break;
        }
    }

    public double getResult(double money){
        return cashSuper.acceptCash(money);
    }
}
